<?php
require_once 'init.php';
include 'isValidToken.php';
if(!$logined){
	echo "登陆失败";
	return;
}
$client = new GuzzleHttp\Client([
            'timeout' => 5.0,
        ]);
$query= [
           
        ];
$json= [
            'loginName' => '13273889535',
            'password'  => 'chen369369'
        ];
//伪装HTTP头
$headers=[
'User-Agent'=>'Mozilla/5.0 (Linux; U; Android 4.1.2; zh-cn; GT-I9300 Build/JZO54K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 MicroMessenger/5.2.380',
'Authorization'=>$Authorization,
'Connection'=>'keep-alive',
'Host'=>' courseapi.ulearning.cn',
'Origin'=>' https://courseweb.ulearning.cn',
'Accept'=>'application/json, text/javascript, */*; q=0.01',
'Sec-Fetch-Dest'=>'empty',
'Content-Type'=>'application/json',
'Sec-Fetch-Site'=>'same-site',
'Sec-Fetch-Mode'=>'cors',
'Referer'=>'https://courseweb.ulearning.cn/ulearning/index.html',
'Accept-Encoding'=>'gzip, deflate, br',
'Accept-Language'=>'zh-CN,zh;q=0.9',
];
$res = $client->request('GET', "https://courseapi.ulearning.cn/courses/students?keyword=&publishStatus=-1&type=1&pn=1&ps=15", [
            // 'query' => $query,
			// 'json'=>$json,
            'headers' => $headers,
            // 'debug' => true
        ])->getBody()->getContents();
foreach(json_decode($res,true)['courseList']as $item){
	echo$item['id'].'=>'.$item['name'].','."\n";
}